package com.yijietong.yiliao.doctor.service.impl;

import javax.annotation.Resource;

import com.yijietong.yiliao.doctor.dao.IUserDao;
import com.yijietong.yiliao.doctor.pojo.User;
import com.yijietong.yiliao.doctor.pojo.UserToken;
import com.yijietong.yiliao.doctor.service.IUserService;
import org.springframework.stereotype.Service;




@Service("userService")
public class UserServiceImpl implements IUserService {

	@Resource
	private IUserDao userDao;

	@Override
	public User getUserByUserId(String userId) {
		return this.userDao.selectByUserId(userId);
	}

	@Override
	public User getUserByPhone(String phone) {
		return userDao.selectByPhone(phone);
	}

	@Override
	public int addUser(User user) {
		return userDao.insert(user);
	}

	@Override
	public int updateUser(User user) {
		return userDao.updateByPhone(user);
	}

	@Override
	public int insertToken(UserToken userToken) {
		return userDao.insertToken(userToken);
	}

	@Override
	public UserToken getTokenCreateByToken(String token) {
		return userDao.selectTokenByToken(token);
	}

}
